from multiprocessing import Pool

from core.downloader import Downloader
from core.args import DownloadArgs
from util.utils import Utils


def job(url):
    # 参数
    args = DownloadArgs()
    args.no_caption().output_dir(r'D:\downloadfile')
    # downloader
    downloader = Downloader(args=args)
    downloader.url(url)
    downloader.start()


if __name__ == '__main__':
    # 从文件取到url list
    urls = Utils.url_list_from_file(r'urls.txt')
    #  线程池
    pool = Pool(8)
    pool.map(job, urls)
